package com.example.demo.error;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import com.example.demo.common.BaseResult;

@RestControllerAdvice
public class ErrorController {

	/**
	 * 捕捉 CustomRealm 抛出的异常
	 */
	@ExceptionHandler(Exception.class)
	public BaseResult handleShiroException(Exception ex) {
		return new BaseResult(500, "异常 : " + ex.getMessage(), null);
	}
}
